package com.qq.weixin.constant;

/**
 * 消息类别
 * @author li.jiang
 *
 */
public final class MsgType {
    /**
     * 文本消息
     */
    public static final String TEXT = "text";
    /**
     * 图片消息
     */
    public static final String IMAGE = "image";
    /**
     * 语音消息
     */
    public static final String VOICE = "voice";
    /**
     * 视频消息
     */
    public static final String VIDEO = "video";
    /**
     * 音乐消息
     */
    public static final String MUSIC = "music";
    /**
     * 图文消息
     */
    public static final String NEWS = "news";
    /**
     * 小视频消息
     */
    public static final String SHORT_VIDEO = "shortvideo";
    /**
     * 地理位置消息
     */
    public static final String LOCATION = "location";
    /**
     * 链接消息
     */
    public static final String LINK = "link";
    /**
     * 事件
     */
    public static final String EVENT = "event";
    /**
     * 转接人工客服
     */
    public static final String KF = "transfer_customer_service";
    /**
     * 构造函数
     */
    private MsgType() {
    }
    /**
     * 在XML中匹配指定消息类别的正则表达式
     * @author li.jiang
     *
     */
    static final class Regex {
        public static final String TEXT = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[text\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Content\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/Content\\>\\s*" // NOSONAR
                + "\\s*\\<MsgId\\>\\d+\\<\\/MsgId\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String IMAGE = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[image\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<PicUrl\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/PicUrl\\>\\s*" // NOSONAR
                + "\\s*\\<MediaId\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/MediaId\\>\\s*" // NOSONAR
                + "\\s*\\<MsgId\\>\\d+\\<\\/MsgId\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String VOICE = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[voice\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<MediaId\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/MediaId\\>\\s*" // NOSONAR
                + "\\s*\\<Format\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/Format\\>\\s*" // NOSONAR
                + "\\s*\\<MsgId\\>\\d+\\<\\/MsgId\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String VIDEO = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[video\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<MediaId\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/MediaId\\>\\s*" // NOSONAR
                + "\\s*\\<ThumbMediaId\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ThumbMediaId\\>\\s*" // NOSONAR
                + "\\s*\\<MsgId\\>\\d+\\<\\/MsgId\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String SHORT_VIDEO = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[shortvideo\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<MediaId\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/MediaId\\>\\s*" // NOSONAR
                + "\\s*\\<ThumbMediaId\\>\\<\\!\\[CDATA\\[.*\\]\\]\\>\\<\\/ThumbMediaId\\>\\s*" // NOSONAR
                + "\\s*\\<MsgId\\>\\d+\\<\\/MsgId\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String LOCATION = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[location\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Location_X\\>.+\\<\\/Location_X\\>\\s*" // NOSONAR
                + "\\s*\\<Location_Y\\>.+\\<\\/Location_Y\\>\\s*" // NOSONAR
                + "\\s*\\<Scale\\>\\d+\\<\\/Scale\\>\\s*" // NOSONAR
                + "\\s*\\<Label\\>\\<\\!\\[CDATA\\[.*\\]\\]\\>\\<\\/Label\\>\\s*" // NOSONAR
                + "\\s*\\<MsgId\\>\\d+\\<\\/MsgId\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR

        public static final String LINK = "\\s*\\<xml\\>\\s*" // NOSONAR
                + "\\s*\\<ToUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/ToUserName\\>\\s*" // NOSONAR
                + "\\s*\\<FromUserName\\>\\<\\!\\[CDATA\\[.+\\]\\]\\>\\<\\/FromUserName\\>\\s*" // NOSONAR
                + "\\s*\\<CreateTime\\>\\d+\\<\\/CreateTime\\>\\s*" // NOSONAR
                + "\\s*\\<MsgType\\>\\<\\!\\[CDATA\\[link\\]\\]\\>\\<\\/MsgType\\>\\s*" // NOSONAR
                + "\\s*\\<Title\\>\\<\\!\\[CDATA\\[.*\\]\\]\\>\\<\\/Title\\>\\s*" // NOSONAR
                + "\\s*\\<Description\\>\\<\\!\\[CDATA\\[.*\\]\\]\\>\\<\\/Description\\>\\s*" // NOSONAR
                + "\\s*\\<Url\\>\\<\\!\\[CDATA\\[.*\\]\\]\\>\\<\\/Url\\>\\s*" // NOSONAR
                + "\\s*\\<MsgId\\>\\d+\\<\\/MsgId\\>\\s*" // NOSONAR
                + "\\s*\\<\\/xml\\>\\s*"; // NOSONAR
        private Regex() {
        }
    }
}
